<script setup>
import { SINGLE_ANS_MAP } from '@/constant'

const props = defineProps({
    data: Object
})
const options = ["optionA", "optionB", "optionC", "optionD", "optionE"]

const mode = ref("exam")

const sumbit = () => {
    console.log("sumbit")
    console.dir(props.data)

    // props.data.questions.forEach((it) => {
    //     const type = it.type;
    //     ansInfo.ids.push(it.no)
    //     ansInfo.score.push(it.score)
    //     ansInfo.myAns.push(it.myAns)

    //     if (type == 'single') {
    //         ansInfo.rightAns.push(it.contentSelect.answer)
    //         const isRight = it.myAns == it.contentSelect.answer
    //         if (!isRight) {
    //             scoreInfo.errorList.push(it.id)
    //         }
    //         ansInfo.isRight.push(isRight)
    //         ansInfo.isRightIds[it.id] = isRight

    //     } else if (type == 'judge') {
    //         ansInfo.rightAns.push(it.contentJudge.answer)
    //         const isRight = it.myAns == it.contentJudge.answer
    //         if (!isRight) {
    //             scoreInfo.errorList.push(it.question.id)
    //         }
    //         ansInfo.isRight.push(isRight)
    //         ansInfo.isRightIds[it.question.id] = isRight
    //     }
    // })

    mode.value = "ansview"
}
// 包装成试卷格式
const paperQuestion = computed(() => {
    return props.data?.questions.map((it) => {
        return {
            question: it,
            no: it.no,
            myAns: ''
        }
    })
})
</script>
<template>
    <div class="box p-6">
        <h4>练习题</h4>
        <div>
            <div v-for="(it, idx) in paperQuestion" :key="it.id">
                <AppPaperSubjectItem :paperQuestion="it" :idx="idx + 1" />
            </div>
        </div>

        <!-- <h4>必做题{{ data?.questions.length }}</h4>
        <p>You will get only those email notification what you want.</p>

        <h4>选做题</h4>
        <p>You will get only those email notification what you want.</p>

        <h4>挑战题</h4>
        <p>You will get only those email notification what you want.</p> -->
    </div>
</template>
